#pragma once

//
// These drive me nuts
//
#pragma warning (disable: 4244) // 'argument' : conversion from 'LPARAM' to 'LONG', possible loss of data
#pragma warning (disable: 4312) // 'type cast' : conversion from 'LONG' to 'WNDPROC' of greater size


#define WINVER 0x0501
#define _WIN32_WINNT 0x0501

#define STRICT
#include <windows.h>
#include <windowsx.h>
#include <richedit.h>
#include <ole2.h>
#include <commctrl.h>
#include <shlwapi.h>
#include <winhttp.h>

#include <string>
#include <sstream>
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

#include <strsafe.h>

#include <ctime>

using namespace std;

class FStr
{
    vector<wchar_t> buf;
public:
    FStr(size_t max) : buf(max, 0) {}
    wstring str() const { return wstring(&*buf.begin()); }
    size_t size() const { return buf.size(); }
    wchar_t *operator & () { return &*buf.begin(); }
};

template<typename T, typename U>
U &Entry(map<T,U> &m, const T &k) {
    map<T,U>::iterator i = m.find(k);
    if (i == m.end()) {
        m[k] = U();
        return m[k];
    }
    else {
        return (*i).second;
    }
}
